﻿/***
 * Contains DropDownList formatter for SlickGrid.
 * @module Formatters
 * @namespace Slick
 */

function DropDownListFormatter(row, cell, value, columnDef, dataContext) {
	var optValues;
	if (columnDef.options || dataContext.options) {
		optValues = dataContext.options || columnDef.options;
	} else {
		optValues = [{ Value: "true", Text: "Yes" }, { Value: "false", Text: "No" }];
	}
	var vals = $.grep(optValues, function(option, i) { return option.Value == value; });
	return "<div class='slick-cell-select'>" + (vals.length > 0 ? vals[0].Text : "") + "</div>";
}
